#include <project.h>
#include "Global.h"




CY_ISR(ISR_Timer_1ms);
void Timer_1ms_init(void)
{
   IN_1MS_StartEx(ISR_Timer_1ms);
   TIMER_Start();
}


CY_ISR(UART_RXTXINT);
void UART_Initi(void)
{
//   UART_Start(); 
//   UART_SetCustomInterruptHandler(UART_RXTXINT);
//   UART_DISABLE_INTR_TX(UART_INTR_TX_EMPTY);
//   UART_ENABLE_INTR_RX(UART_INTR_RX_NOT_EMPTY);
}




void Watchdog_Init(void)   //看门狗初始化，约900ms
{
  CySysWdtSetIgnoreBits(1);
  CySysWdtEnable();
  CySysClkIloStartMeasurement();
}

void InitMCU(void)
{   
    uchar i;
    
	CyGlobalIntDisable;					// Disnable Global interrupts
    
 	Timer_1ms_init();
    
    UART_Initi();

    

    
	CyGlobalIntEnable;					//  Enable Global interrupts
       
    for(i=0;i<10;i++)
    {
      CyDelay(10);
    }
    Watchdog_Init();
}
